<!-- 从业者-个人求职-企业介绍-->
<template>
	<view class="resume-container">
		<!-- 顶部用户信息区域 -->
		<view class="company-info" @click="navigateTo('registerthree')">

			<view class="info-right">
				<view class="company-name">{{ qyData.yyzz.yyzz_name }}</view>
				<view class="phone">{{ qyData.qyxx.qyxx_name }}</view>
			</view>
			<view>
				<!-- 头像 -->
				<view class="info-left">
					<u-avatar mode="square" size="150" :src="qyData.qyxx.logo_img_uri[0].url"></u-avatar>
				</view>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 工作地点和地图 -->
		<!-- 培训经历 -->
		<view class="section">
			<view class="section-header">
				<text class="title">工作地址：详细具体的地址</text>
			</view>
			<!-- 地图定位 -->
			<view class="map-container">
				<map style="width: 100%; height: 200px;" :latitude="latitude" :longitude="longitude" :markers="markers"
					show-location></map>
				<view class="map-tip">地图定位</view>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>


		<!-- 企业介绍 -->
		<view class="section">
			<view class="section-header">
				<text class="title">企业介绍</text>
			</view>
			<view class="section-content">
				<!-- 加载更多 -->
				<u-read-more :show-height="200" :toggle="true" color="#03B8CD"  :shadow-style="shadowStyle">
					<rich-text :nodes="qyData.qyxx.qyxx_desc"></rich-text>
				</u-read-more>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>


		<!-- 员工福利 -->
		<view class="section">
			<view class="section-header">
				<text class="title">员工福利</text>
			</view>
			<view class="section-content">
				<view class="timeSection">
					<text class="title-name">五险一金</text>
					<text class="title-time">定期体检</text>
				</view>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 企业相册 -->
		<view class="section">
			<view class="section-header">
				<text class="title">企业相册</text>
			</view>
			<view class="section-content">
				<!-- 加载更多 -->
				<!-- 				<u-read-more :show-height="200" :toggle="true">
					<rich-text :nodes="workContent"></rich-text>
				</u-read-more> -->
				<!-- 相册横向滚动 -->
				<scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="120">
					<view id="demo1" class="scroll-view-item_H uni-bg-red"><image style="width: 200px; height: 200rpx; border: 1px solid #F1FF7F7;" :src="qyData.qyxx.door_img_uri[0].url"></image></view>
					<view id="demo2" class="scroll-view-item_H uni-bg-green"><image style="width: 200px; height: 100px;" :src="qyData.qyxx.in_img_uri[0].url"></view>
					<view id="demo3" class="scroll-view-item_H uni-bg-blue"><image style="width: 200px; height: 100px;" :src="qyData.qyxx.in_img_uri[1].url"></view>
				</scroll-view>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 工商信息 -->
		<view class="user-info">
			<view class="info-main">
				<view class="name-line">
					<text class="name">工商信息</text>
				</view>
				<view class="meta-info">
					<view class="">
						<text>公司全称：</text>
						<text>{{ qyData.yyzz.yyzz_name }}</text>
					</view>
					<view class="">
						<text>社会信用代码：</text>
						<text>{{ qyData.yyzz.yyzz_code }}</text>
					</view>
					<view class="">
						<text>法定代表人：</text>
						<text>{{ qyData.yyzz.yyzz_username }}</text>
					</view>
					<view class="">
						<text>注册/成立日期：</text>
						<text>{{ qyData.yyzz.yyzz_startdate }}</text>
					</view>
				</view>
			</view>
		</view>

		<!-- 分隔线 -->
		<u-line color="#c1c3c7" length="90%" margin="0 10px"></u-line>

		<!-- 空块 -->
		<view class="section">
			<view class="section-header">
				<text class="title"></text>
			</view>
			<view class="section-content">
				<view class="workSection">
				</view>
				<view class="timeSection">
				</view>
			</view>
		</view>
	</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shadowStyle: {
					backgroundImage: "linear-gradient(-180deg, rgba(255, 255, 255, 0) 0%, #F1F7F7 80%)",
					paddingTop: "300rpx",
					marginTop: "-300rpx",
					
				},

				// 导航信息
				latitude: 39.90469, // 企业纬度
				longitude: 116.40717, // 企业经度
				markers: [{
					id: 1,
					latitude: 39.90469,
					longitude: 116.40717,
					title: '企业名称',
					iconPath: '/static/location.png'
				}],

				// 按钮组中的样式写法
				customStyleObject: {
					marginRight: '20rpx',
					// margin-right: 20rpx;

				},
				expanded: false, // 控制个人介绍是否展开
				// 弹窗
				// 弹出窗口内容
				show: false,
				mode: "selector",
				range: ['康养师', '护理师', '健康顾问', '康复治疗师', '营养师'],
				NumberValue: 0,
				// field控件的样式
				placeholderStyle: "color:#bcbcbc",
				required: true,
				showInvitePopup: false,
				form: {
					position: '',
					interviewTime: '',
					address: '',
					contactPerson: '',
					contactPhone: ''
				},
				// 加载个人介绍
				scrollTop: 0,
				old: {
					scrollTop: 0
				},
				qyFlowId: '',
				qyData: []
			}
		},
		onLoad(options) {
			this.qyFlowId = options.flowid
		},
		onShow() {
			this.$u.api.querygw({
				gwiflowid : this.qyFlowId
			}).then(res => {
				console.log('某个企业：', res)
				this.qyData = res.data.base_info[0].jginfo
			})			
		},
		methods: {
			publishJob() {
				// uni.navigateTo({
				// 	url: '/pages/invite/invite-invitation'
				// });
				this.showInvitePopup = true;
			},
			// 弹窗
			// 选择岗位
			selectPosition(e) {
				this.form.position = this.positionOptions[e[0]]
				this.showPositionPicker = false
			},
			// 选择时间
			selectTime(e) {
				this.form.interviewTime = `${e.year}-${e.month}-${e.day} ${e.hour}:${e.minute}`
				this.showTimePicker = false
			},
			// 横向滚动
			scroll: function(e) {
				// console.log(e)
				this.old.scrollTop = e.detail.scrollTop
			},
			// 提交邀请
			submitInvitation() {
				if (!this.validateForm()) return

				// 这里可以调用API发送邀请
				console.log('提交邀请:', this.form)
				this.$u.toast('邀请已发送')
				this.resetForm()
				this.showInvitePopup = false
			},
			// 表单验证
			validateForm() {
				if (!this.form.position) {
					this.$u.toast('请选择面试岗位')
					return false
				}
				if (!this.form.interviewTime) {
					this.$u.toast('请选择面试时间')
					return false
				}
				if (!this.form.address) {
					this.$u.toast('请输入面试地址')
					return false
				}
				if (!this.form.contactPerson) {
					this.$u.toast('请输入联系人')
					return false
				}
				if (!this.form.contactPhone) {
					this.$u.toast('请输入联系电话')
					return false
				}
				if (!/^1[3-9]\d{9}$/.test(this.form.contactPhone)) {
					this.$u.toast('请输入正确的手机号码')
					return false
				}
				return true
			},
			// 重置表单
			resetForm() {
				this.form = {
					position: '',
					interviewTime: '',
					address: '',
					contactPerson: '',
					contactPhone: ''
				}
			},
			// 显示经营类型弹窗
			isShowPicker(value) {
				if (value == 0) {
					this.NumberValue = value;
					this.mode = "selector";
					this.range = ['有限责任公司', '股份有限公司', '个体工商户', '其他'];
					this.defaultSelector = [0];
				} else if (value == 1) {
					this.NumberValue = value;
					this.mode = "selector";
					this.range = ['营业中', '暂停营业'];
					this.defaultSelector = [0];
				} else {
					this.NumberValue = value;
					this.mode = "region"
					// this.range = [['亚洲', '欧洲'], ['中国', '日本'], ['北京', '上海', '广州']];
					// this.defaultSelector = [0, 0, 0];
				}
				this.show = true
			},
		}
	}
</script>

<style lang="scss" scoped>
	.resume-container {
		// padding: 30rpx;
		background-color: #F1F7F7;
		// min-height: 160vh;

		// 企业信息
		.company-info {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 30rpx;
			background-color: #F1F7F7;
			border-radius: 16rpx;
			margin-bottom: 4rpx;

			.info-right {
				flex: 1;
				display: flex;
				flex-direction: column;
				justify-content: center;

				.company-name {
					font-size: 36rpx;
					font-weight: bold;
					margin-bottom: 10rpx;
				}

				.phone {
					font-size: 28rpx;
					color: #666;
					margin-bottom: 10rpx;
				}

				.company-type {
					font-size: 26rpx;
					color: #888;
				}
			}
		}


		.user-info {
			// display: flex;
			background-color: #F1F7F7;
			border-radius: 16rpx;
			padding: 30rpx;
			// margin-bottom: 5rpx;

			.avatar-container {
				margin-right: 30rpx;

				.avatar {
					width: 74px;
					height: 99px;
					// border-radius: 50%;
					background-color: #F1F7F7;
					border: 2rpx solid #f0f0f0;
				}
			}

			.info-main {
				flex: 1;

				.name-line {
					display: flex;
					align-items: center;
					// flex-direction: column;
					// margin-bottom: 30rpx;

					.name {
						font-size: 36rpx;
						font-weight: bold;
						color: #333;
						margin-right: 20rpx;
					}

					.gender {
						font-size: 24rpx;
						color: #2979ff;
						background-color: #F1F7F7;
						padding: 4rpx 15rpx;
						border-radius: 20rpx;
					}
				}
        
				.meta-info {
					display: flex;
					flex-direction: column;
					align-items: left;
					font-size: 26rpx;
					color: #666;
					// margin-bottom: 30rpx;

					text {
						margin-right: 15rpx;

						&:last-child {
							margin-right: 0;
						}
					}
				}

				.contact-info {
					.phone {
						// display: block;
						font-size: 26rpx;
						color: #666;
						// margin-bottom: 8rpx;
						margin-right: 10px;

						&:last-child {

							margin-bottom: 0;
						}
					}
				}
			}
		}

		.section {
			background-color: #F1F7F7;
			border-radius: 16rpx;
			padding: 30rpx;
			// border: 1px solid #55ff7f;

			.section-header {
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding-bottom: 20rpx;

				.title {
					font-size: 32rpx;
					font-weight: bold;
					color: #333;
				}

				.status {
					font-size: 26rpx;
					color: #19be6b;
				}
			}



			.section-content {
				.intention-item {
					display: flex;
					font-size: 28rpx;
					color: #666;
					margin-bottom: 15rpx;

					.label {
						color: #333;
						font-weight: bold;
						margin-right: 10rpx;
					}
				}


				.intro-text {
					font-size: 28rpx;
					color: #666;
					line-height: 1.6;

					&.collapsed {
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 3;
						overflow: hidden;
					}
				}

				.expand-btn {
					display: flex;
					align-items: center;
					justify-content: flex-end;
					color: #2979ff;
					font-size: 26rpx;
					margin-top: 15rpx;

					.u-icon {
						margin-left: 8rpx;
					}
				}
			}


			// 个人证书样式
			.certificates {
				.cert-row {
					margin-bottom: 20rpx;
				}

				.cert-names {
					// flex 通过 flex-direction 改变排列样式
					display: flex;
					flex-direction: column;

					.cert-name {
						width: 48%;
						font-size: 26rpx;
						color: #666;
						text-align: center;
					}
				}
			}
		}

		// 岗位与时间
		.timeSection {
			margin: 10px 0;

			.title-name {
				margin-right: 20px;
			}
		}


		.button-group {
			position: fixed;
			bottom: 0;
			left: 0;
			right: 0;
			padding: 20rpx 30rpx;
			background-color: #F1F7F7;
			display: flex;
			justify-content: space-between;
			box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05);

			// 此样式主要为了适配wx小程序的按钮
			/deep/ .u-size-default {
				width: 150px;
			}

			.u-btn {
				flex: 1;

				&:first-child {
					margin-right: 20rpx;
				}
			}
		}

		.map-container {
			background-color: #F1F7F7;
		}

		// 企业相册，横向滚动
		.scroll-view_H {
			white-space: nowrap;
			width: 100%;
		}

		.scroll-view-item {
			height: 300rpx;
			line-height: 300rpx;
			text-align: center;
			font-size: 36rpx;
		}

		.scroll-view-item_H {
			display: inline-block;
			width: 100%;
			height: 300rpx;
			line-height: 300rpx;
			text-align: center;
			font-size: 36rpx;
		}


	}
</style>